package com.example.demo.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName food
 */
@TableName(value ="food")
@Data
public class Food implements Serializable {
    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 食物名称
     */
    @TableField(value = "food_Name")
    private String foodName;

    /**
     * 水果/蔬菜
     */
    @TableField(value = "food_Sort")
    private Integer foodSort;

    /**
     * 图片
     */
    @TableField(value = "image")
    private String image;

    /**
     * 能量
     */
    @TableField(value = "energy")
    private Double energy;

    /**
     * 碳水化合物
     */
    @TableField(value = "carbs")
    private Double carbs;

    /**
     * 蛋白质
     */
    @TableField(value = "protein")
    private Double protein;

    /**
     * 膳食纤维
     */
    @TableField(value = "dietary_Fiber")
    private Double dietaryFiber;

    /**
     * 脂肪
     */
    @TableField(value = "fat")
    private Double fat;

    /**
     * 胆固醇
     */
    @TableField(value = "cholesterol")
    private Double cholesterol;

    /**
     * 水分含量
     */
    @TableField(value = "moisture_Content")
    private Double moistureContent;

    /**
     * 维生素(这个是总含量)
     */
    @TableField(value = "vitamin")
    private Double vitamin;

    /**
     * 微量元素(总)
     */
    @TableField(value = "trace_Element")
    private Double traceElement;

    /**
     * 其他成分
     */
    @TableField(value = "other")
    private Double other;

    /**
     * 创建时间

     */
    @TableField(value = "create_Time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_Time")
    private LocalDateTime updateTime;



    /**
     * 是否删除
     */
    @TableLogic
    @TableField(value = "is_Delete")
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Food other = (Food) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getFoodName() == null ? other.getFoodName() == null : this.getFoodName().equals(other.getFoodName()))
            && (this.getFoodSort() == null ? other.getFoodSort() == null : this.getFoodSort().equals(other.getFoodSort()))
            && (this.getEnergy() == null ? other.getEnergy() == null : this.getEnergy().equals(other.getEnergy()))
            && (this.getCarbs() == null ? other.getCarbs() == null : this.getCarbs().equals(other.getCarbs()))
            && (this.getProtein() == null ? other.getProtein() == null : this.getProtein().equals(other.getProtein()))
            && (this.getDietaryFiber() == null ? other.getDietaryFiber() == null : this.getDietaryFiber().equals(other.getDietaryFiber()))
            && (this.getFat() == null ? other.getFat() == null : this.getFat().equals(other.getFat()))
            && (this.getCholesterol() == null ? other.getCholesterol() == null : this.getCholesterol().equals(other.getCholesterol()))
            && (this.getVitamin() == null ? other.getVitamin() == null : this.getVitamin().equals(other.getVitamin()))
            && (this.getTraceElement() == null ? other.getTraceElement() == null : this.getTraceElement().equals(other.getTraceElement()))
            && (this.getOther() == null ? other.getOther() == null : this.getOther().equals(other.getOther()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getFoodName() == null) ? 0 : getFoodName().hashCode());
        result = prime * result + ((getFoodSort() == null) ? 0 : getFoodSort().hashCode());
        result = prime * result + ((getEnergy() == null) ? 0 : getEnergy().hashCode());
        result = prime * result + ((getCarbs() == null) ? 0 : getCarbs().hashCode());
        result = prime * result + ((getProtein() == null) ? 0 : getProtein().hashCode());
        result = prime * result + ((getDietaryFiber() == null) ? 0 : getDietaryFiber().hashCode());
        result = prime * result + ((getFat() == null) ? 0 : getFat().hashCode());
        result = prime * result + ((getCholesterol() == null) ? 0 : getCholesterol().hashCode());
        result = prime * result + ((getVitamin() == null) ? 0 : getVitamin().hashCode());
        result = prime * result + ((getTraceElement() == null) ? 0 : getTraceElement().hashCode());
        result = prime * result + ((getOther() == null) ? 0 : getOther().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", foodName=").append(foodName);
        sb.append(", foodSort=").append(foodSort);
        sb.append(", energy=").append(energy);
        sb.append(", carbs=").append(carbs);
        sb.append(", protein=").append(protein);
        sb.append(", dietaryFiber=").append(dietaryFiber);
        sb.append(", fat=").append(fat);
        sb.append(", cholesterol=").append(cholesterol);
        sb.append(", vitamin=").append(vitamin);
        sb.append(", traceElement=").append(traceElement);
        sb.append(", other=").append(other);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}